package com.tiku.controller;

import com.tiku.common.ResultJson;
import com.tiku.service.ActivationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Activation")
@CrossOrigin("*")
public class ActivationController {

    @Autowired
    private ActivationService activationService;


    /**
     * 通过激活码查询对应的题库
     * @param code
     * @return
     */
    @GetMapping("/getActivation/{code}")
    public ResultJson getActivation(@PathVariable("code") String code){
        return activationService.getActivation(code);
    }

    /**
     * 通过激活码查询对应的科目
     * @param id
     * @return
     */
    @GetMapping("/getKemu/{id}")
    public ResultJson getKemu(@PathVariable("id") String id){
      return  activationService.getKemu(id);
    }

    /**
     * 通过激活码与科目ID 进行激活课程
     * @param activateCode
     * @param specId
     * @return
     */
    @GetMapping("/activated/{activateCode}/{specId}")
    public ResultJson activated(@PathVariable("activateCode") String activateCode,@PathVariable("specId") String specId){
        return  activationService.activated(activateCode,specId);
    }

}
